home *** CD-ROM | disk | FTP | other *** search
/ Medabots Cardz / Medabots CD Cardz Sumilidon.bin / mac / assets / sumilidon.dxr / 00020_Script_20 < prev    next >
Text File  |  2001-12-07  |  3KB  |  117 lines

  1. property pSpeed, dx, dy, mysprite, counter, buttonover
  2. global showarea, discx, discy, area, smallmedal, portdy, portdx, goback, portnum, medaldown, transitionz, onedown, amiwideopen
  3.  
  4. on beginsprite me
  5.   set mysprite to the spritenum of me
  6.   set the blend of sprite mysprite = 100
  7.   set dx to the loch of sprite(mysprite)
  8.   set dy to the locv of sprite(mysprite)
  9.   counter = 1
  10. end
  11.  
  12. on mouseEnter me
  13.   if smallmedal = 0 then
  14.     showarea = 4
  15.     buttonover = 1
  16.     puppetsound ("hum2"), 2
  17.   end if
  18. end
  19.  
  20. on mouseLeave me
  21.   if smallmedal = 0 then
  22.     showarea = 0
  23.     buttonover = 0
  24.     set the member of sprite mysprite = ("medal")
  25.     puppetsound 1,0
  26.   end if
  27. end
  28.  
  29. on mouseDown me
  30.   medaldown = 4
  31. end
  32.  
  33. on mouseUp me
  34.   medaldown = 0
  35.   if smallmedal = 0 then
  36.     if sprite mysprite intersects sprite(portnum) then
  37.       onedown = 1
  38.       set the blend of sprite mysprite = 0
  39.       set the loch of sprite mysprite to dx
  40.       set the locv of sprite mysprite to dy
  41.       smallmedal = 1
  42.       area = 4
  43.       transitionz = "close"
  44.     else
  45.       set the loch of sprite mysprite to dx
  46.       set the locv of sprite mysprite to dy
  47.     end if 
  48.   end if
  49. end
  50.  
  51. on exitframe
  52.   if medaldown = 4 then
  53.     buttonover = 0
  54.   end if
  55.   
  56.   if area = 0 then
  57.     if amiwideopen = "yes" then
  58.       sprite(mysprite).moveablesprite = TRUE
  59.       end if
  60.     else
  61.       sprite(mysprite).moveablesprite = FALSE
  62.     end if
  63.     
  64.     if goback = 4 then
  65.       set the blend of sprite mysprite = 100
  66.       goback = 0
  67.     end if
  68.     
  69.     if buttonover = 1 then
  70.       if counter < 6 then
  71.         counter = counter + 1
  72.       end if
  73.       if counter = 2 then 
  74.         set the member of sprite mysprite = ("roll1")
  75.       else  if counter = 3 then 
  76.         set the member of sprite mysprite = ("roll2")
  77.       else  if counter = 4 then 
  78.         set the member of sprite mysprite = ("roll3")
  79.       else  if counter = 5 then 
  80.         set the member of sprite mysprite = ("roll4")
  81.       else  if counter = 6 then 
  82.         set the member of sprite mysprite = ("roll5")
  83.         counter = 1
  84.       end if
  85.     end if
  86.     
  87.     
  88.     
  89.     if sprite mysprite intersects sprite(portnum) then
  90.       --    set the width of sprite(mysprite) to 38
  91.       --    set the height of sprite(mysprite) to 40
  92.     else 
  93.       --    set the width of sprite(mysprite) to 66
  94.       --    set the height of sprite(mysprite) to 77
  95.     end if
  96. end
  97.  
  98.  
  99. -- move character
  100. on move me, dx, dy
  101.   -- get current loc
  102.   loc = sprite(me.spriteNum).loc
  103.   
  104.   -- move loc and rect
  105.   global pSpeed
  106.   loc = loc + point(dx,dy)*pSpeed
  107.   rect = rect + rect(dx*pSpeed,dy*pSpeed,dx*pSpeed,dy*pSpeed)
  108.   
  109.   -- safety check to make sure character stays on screen
  110.   if rect.left < 0 then exit
  111.   if rect.top < 0 then exit
  112.   if rect.right > (the stage).rect.width then exit
  113.   if rect.bottom > (the stage).rect.height then exit
  114.   
  115.   -- set new character location
  116.   sprite(me.spriteNum).loc = loc
  117. end